<script type="text/javascript">
  $(document).ready(function(){
      $('#checkAlt').click(function(){
          if($('.check').val() == 1){
              $('.checks').attr('checked', 'checked');
              $('.check').val('0');
          }else{
              $('.checks').removeAttr('checked');
              $('.check').val('1');
          }
      })
  })
</script>
<div class="data-list">
    <fieldset>
        <legend><?php echo "$formTitle";?></legend>
    <?php
      echo form_open($subLink);
    ?>    
    <table class="tabel" style="width: 60%">
        <tr>
            <th>
                <?php
                echo form_checkbox('', '', FALSE, 'id=checkAlt');
                echo '<input type=hidden value=1 class=check>';
                ?>
            </th>
            <th>Nama</th>
            <th>Tgl. Lahir</th>
            <th>Sekolah</th>
            <th>Kelas</th>
            <th>Alamat</th>
            <th>Orang Tua</th>
        </tr>
        <?php
        $no = 1;
        $sess_alt = $this->session->userdata('alternatif');
        foreach ($alternatif as $alt){
        ?>
        <tr class="<?php echo ($no%2)?'even':'odd';?>">
            <td style="text-align: center;">
                <?php
                  $cek = in_array($alt['id'], $sess_alt['id']);
                  if($cek){
                      $checked = TRUE;
                  }else $checked = FALSE;
                  echo form_checkbox('id[]', $alt['id'], $checked, 'class=checks');
                  echo form_hidden('nama[]', $alt['nama']);
                ?>
            </td>
            <td><?php echo $alt['nama'];?></td>
            <td><?php echo datefmysql($alt['tgl_lahir']);?></td>
            <td><?php echo $alt['sekolah'];?></td>
            <td><?php echo $alt['kelas'].' '.$alt['tingkat_pendidikan'];?></td>
            <td><?php echo $alt['alamat'];?></td>
            <td><?php echo $alt['ortu'];?></td>
        </tr>
        <?php
        $no++;
        }
        ?>
    </table>
    <?php
      echo form_submit("add", "Selanjutnya", "class='next' style='margin-right:2px'");
      echo form_close();
    ?>    
    </fieldset>    
</div>
